package com.wgts.wgts.mvp.view.activity.webactivity;

import android.content.Intent;
import android.webkit.JavascriptInterface;

import com.wgts.wgts.MoHuApplication;
import com.wgts.wgts.mvp.view.activity.goodsinfo.JDGoodinfoActivity;
import com.wgts.wgts.mvp.view.activity.main.MoHuMainActivity;
import com.wgts.wgts.tools.Tools;

public class AndroidtoJs{

    // 定义JS需要调用的方法
    // 被JS调用的方法必须加入@JavascriptInterface注解
    @JavascriptInterface
    public void callTelphone() {
        Tools.call(MoHuApplication.getInstance());
    }

    @JavascriptInterface
    public void callTelphone(String tel){
        Tools.call(MoHuApplication.getInstance(), tel);
    }

    @JavascriptInterface
    public void jumpToProductDetailWithID(String productId){
        Intent intent = new Intent(MoHuApplication.getInstance(), JDGoodinfoActivity.class);
        intent.putExtra(JDGoodinfoActivity.PRODUCT_ID, productId);
        MoHuApplication.getInstance().startActivity(intent);
    }

    @JavascriptInterface
    public void JumpToShopList(){
        Intent intent = new Intent(MoHuApplication.getInstance(), MoHuMainActivity.class);
        intent.putExtra(MoHuMainActivity.PAY_RESULT, 1);
        MoHuApplication.getInstance().startActivity(intent);
    }
}

